<html>
<head><meta charset="utf-8"><title>Wanna help finishing up #369 · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html">Wanna help finishing up #369</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="193601429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193601429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193601429">(Apr 10 2020 at 18:27)</a>:</h4>
<p>So i'm looking into the remaining bits of <a href="https://github.com/rust-lang/rust/issues/369" title="https://github.com/rust-lang/rust/issues/369">#369</a>. And found that the <code>ParameterKind</code>s are a little tricky to deal with.</p>



<a name="193601645"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193601645" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193601645">(Apr 10 2020 at 18:29)</a>:</h4>
<p>The interning itself is not hard. However currently the <code>Binders</code> and <code>Canonical</code> doesn't carry interner info with it.</p>



<a name="193601752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193601752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193601752">(Apr 10 2020 at 18:30)</a>:</h4>
<p>what's more, <code>Canonical</code> supports <code>PartialOrd</code> and <code>Ord</code> here.</p>



<a name="193601887"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193601887" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193601887">(Apr 10 2020 at 18:31)</a>:</h4>
<p>Before i start hacking on this, i want to validate that i'm doing the right thing first, so here are my questions:</p>



<a name="193601994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193601994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193601994">(Apr 10 2020 at 18:32)</a>:</h4>
<ol>
<li>Do i need to intern each <code>ParameterKind</code> in the <code>Vec</code> separately?</li>
</ol>



<a name="193602052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193602052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193602052">(Apr 10 2020 at 18:33)</a>:</h4>
<ol start="2">
<li>Is it reasonable to add <code>PartialOrd</code> and <code>Ord</code> to the bounds of <code>InternedParameterKindsWithUniverseIndex</code>?</li>
</ol>



<a name="193602399"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193602399" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193602399">(Apr 10 2020 at 18:36)</a>:</h4>
<ol start="3">
<li>I'm gonna change <code>Canonical&lt;T&gt;</code> to <code>Canonical&lt;I: Interner, T&gt;</code>, is this correct?</li>
</ol>



<a name="193602452"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193602452" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193602452">(Apr 10 2020 at 18:37)</a>:</h4>
<p>Going to sleep now. I think i can do the hacking when i wake up.</p>



<a name="193602830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193602830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193602830">(Apr 10 2020 at 18:40)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116458">Charles Lew</span> <a href="#narrow/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369/near/193601994" title="#narrow/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369/near/193601994">said</a>:</p>
<blockquote>
<ol>
<li>Do i need to intern each <code>ParameterKind</code> in the <code>Vec</code> separately?</li>
</ol>
</blockquote>
<p>No, I don't think so</p>



<a name="193602943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193602943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193602943">(Apr 10 2020 at 18:41)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116458">Charles Lew</span> <a href="#narrow/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369/near/193602052" title="#narrow/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369/near/193602052">said</a>:</p>
<blockquote>
<ol start="2">
<li>Is it reasonable to add <code>PartialOrd</code> and <code>Ord</code> to the bounds of <code>InternedParameterKindsWithUniverseIndex</code>?</li>
</ol>
</blockquote>
<p>For <code>Canonical</code>? What happens if we don't derive <code>PartialOrd and </code>Ord<code> for that? (IIRC, it create problems with the coherence tree in </code>chalk-solve`). Might be worth looking at if we can order based on hash. Since there is no "real" ordering.</p>



<a name="193602948"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193602948" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193602948">(Apr 10 2020 at 18:41)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116458">Charles Lew</span> <a href="#narrow/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369/near/193602399" title="#narrow/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369/near/193602399">said</a>:</p>
<blockquote>
<ol start="3">
<li>I'm gonna change <code>Canonical&lt;T&gt;</code> to <code>Canonical&lt;I: Interner, T&gt;</code>, is this correct?</li>
</ol>
</blockquote>
<p><code>Canonical&lt;T&gt;</code> already implements <code>HasInterner</code> using <code>T::Interner</code>, so I don't think that's needed</p>



<a name="193603049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193603049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193603049">(Apr 10 2020 at 18:42)</a>:</h4>
<p>well</p>



<a name="193603133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193603133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193603133">(Apr 10 2020 at 18:43)</a>:</h4>
<p>you need <code>I: Interner</code> because <code>binders</code> with become <code>I::Interned&lt;something&gt;</code></p>



<a name="193603401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193603401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193603401">(Apr 10 2020 at 18:45)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369/near/193602943" title="#narrow/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369/near/193602943">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="116458">Charles Lew</span> <a href="#narrow/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369/near/193602052" title="#narrow/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369/near/193602052">said</a>:</p>
<blockquote>
<ol start="2">
<li>Is it reasonable to add <code>PartialOrd</code> and <code>Ord</code> to the bounds of <code>InternedParameterKindsWithUniverseIndex</code>?</li>
</ol>
</blockquote>
<p>For <code>Canonical</code>? What happens if we don't derive <code>PartialOrd and </code>Ord<code> for that? (IIRC, it create problems with the coherence tree in </code>chalk-solve`). Might be worth looking at if we can order based on hash. Since there is no "real" ordering.</p>
</blockquote>
<p>Just checked, we don't need the <code>PartialOrd</code>/<code>Ord</code> on <code>Canonical</code> or <code>UCanonical</code></p>



<a name="193603402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193603402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193603402">(Apr 10 2020 at 18:45)</a>:</h4>
<p>Won't that become <code>T::Interner::Interned&lt;something&gt;</code>? (optionally through <code>HasInterner</code> with  <code>Canonical&lt;T&gt;::Interner</code>)</p>



<a name="193603457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193603457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193603457">(Apr 10 2020 at 18:46)</a>:</h4>
<p>uh, I mean</p>



<a name="193603476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193603476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193603476">(Apr 10 2020 at 18:46)</a>:</h4>
<p>I think you could do</p>



<a name="193603564"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193603564" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193603564">(Apr 10 2020 at 18:47)</a>:</h4>
<div class="codehilite"><pre><span></span>pub struct Canonical&lt;T: HasInterner&gt; {
  value: T,
  binders: T::Interner::Interned&lt;something&gt;,
}
</pre></div>



<a name="193603746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193603746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193603746">(Apr 10 2020 at 18:48)</a>:</h4>
<p>but you could also do:</p>
<div class="codehilite"><pre><span></span>pub struct Canonical&lt;I: Interner, T&gt; {
  value: T,
  binders: I::&lt;something&gt;,
}
</pre></div>



<a name="193603785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193603785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193603785">(Apr 10 2020 at 18:49)</a>:</h4>
<p>or if you really want to make sure that <code>&lt;T as HasInterner&gt;::Interner == I</code>:</p>



<a name="193603899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193603899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193603899">(Apr 10 2020 at 18:50)</a>:</h4>
<p>err</p>



<a name="193603922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193603922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193603922">(Apr 10 2020 at 18:50)</a>:</h4>
<p>nvm, I don't want to have to think about it</p>



<a name="193604341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193604341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193604341">(Apr 10 2020 at 18:54)</a>:</h4>
<p>Right, the second associates the interner more directly with the binders, instead of the value</p>



<a name="193604546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193604546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193604546">(Apr 10 2020 at 18:56)</a>:</h4>
<p>The only potential problem with the first is if we currently store any value that isn't <code>HasInterner</code></p>



<a name="193636114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193636114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193636114">(Apr 11 2020 at 01:35)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369/near/193603564" title="#narrow/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369/near/193603564">said</a>:</p>
<blockquote>
<div class="codehilite"><pre><span></span>pub struct Canonical&lt;T: HasInterner&gt; {
  value: T,
  binders: T::Interner::Interned&lt;something&gt;,
}
</pre></div>


</blockquote>
<p>Yes, theoretically i can do this, in reality i tried and find that the bound got spread into <strong>many many</strong> places, even outside <code>chalk-ir</code> crate...</p>



<a name="193636171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193636171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193636171">(Apr 11 2020 at 01:37)</a>:</h4>
<p>For <code>Canonical</code>?</p>



<a name="193636173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193636173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193636173">(Apr 11 2020 at 01:37)</a>:</h4>
<p>That's <em>probably</em> okay?</p>



<a name="193638130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193638130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193638130">(Apr 11 2020 at 02:27)</a>:</h4>
<p><span class="user-mention" data-user-id="232957">@Jack Huey</span> I'll use <code>Canonical&lt;I: Interner, T&gt;</code> for now, and see whether i can switch to Canonical&lt;T: HasInterner&gt; as a follow-up.</p>



<a name="193638175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193638175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193638175">(Apr 11 2020 at 02:28)</a>:</h4>
<p>One more question, i don't really understand this <code>Fold</code> trait.</p>
<div class="codehilite"><pre><span></span><span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">I</span><span class="p">,</span><span class="w"> </span><span class="n">TI</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Fold</span><span class="o">&lt;</span><span class="n">I</span><span class="p">,</span><span class="w"> </span><span class="n">TI</span><span class="o">&gt;</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Canonical</span><span class="o">&lt;</span><span class="n">I</span><span class="p">,</span><span class="w"> </span><span class="n">T</span><span class="o">&gt;</span><span class="w"></span>
<span class="k">where</span><span class="w"></span>
<span class="w">    </span><span class="n">T</span>: <span class="nc">Fold</span><span class="o">&lt;</span><span class="n">I</span><span class="p">,</span><span class="w"> </span><span class="n">TI</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">I</span>: <span class="nc">Interner</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">TI</span>: <span class="nc">TargetInterner</span><span class="o">&lt;</span><span class="n">I</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nb">Result</span> <span class="o">=</span><span class="w"> </span><span class="n">Canonical</span><span class="o">&lt;</span><span class="n">TI</span><span class="p">,</span><span class="w"> </span><span class="n">T</span>::<span class="nb">Result</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">fold_with</span><span class="o">&lt;</span><span class="na">&#39;i</span><span class="o">&gt;</span><span class="p">(</span><span class="w"></span>
<span class="w">        </span><span class="o">&amp;</span><span class="bp">self</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="n">folder</span>: <span class="kp">&amp;</span><span class="nc">mut</span><span class="w"> </span><span class="n">dyn</span><span class="w"> </span><span class="n">Folder</span><span class="o">&lt;</span><span class="na">&#39;i</span><span class="p">,</span><span class="w"> </span><span class="n">I</span><span class="p">,</span><span class="w"> </span><span class="n">TI</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="n">outer_binder</span>: <span class="nc">DebruijnIndex</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Fallible</span><span class="o">&lt;</span><span class="n">Self</span>::<span class="nb">Result</span><span class="o">&gt;</span><span class="w"></span>
<span class="w">    </span><span class="k">where</span><span class="w"></span>
<span class="w">        </span><span class="n">I</span>: <span class="na">&#39;i</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="n">TI</span>: <span class="na">&#39;i</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">Canonical</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="n">binders</span>: <span class="nc">self_binders</span><span class="p">,</span><span class="w"></span>
<span class="w">            </span><span class="n">value</span>: <span class="nc">self_value</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">self</span><span class="p">;</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">value</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">self_value</span><span class="p">.</span><span class="n">fold_with</span><span class="p">(</span><span class="n">folder</span><span class="p">,</span><span class="w"> </span><span class="n">outer_binder</span><span class="p">.</span><span class="n">shifted_in</span><span class="p">())</span><span class="o">?</span><span class="p">;</span><span class="w"></span>
<span class="w">        </span><span class="nb">Ok</span><span class="p">(</span><span class="n">Canonical</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="n">binders</span>: <span class="nc">self_binders</span><span class="p">.</span><span class="n">clone</span><span class="p">(),</span><span class="w"></span>
<span class="w">            </span><span class="n">value</span>: <span class="nc">value</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="p">})</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
<span class="err">```</span><span class="w"></span>
</pre></div>



<a name="193638192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193638192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193638192">(Apr 11 2020 at 02:29)</a>:</h4>
<p>So it seems there're two interners. I need to grasp the <code>self_binders</code>'s actually data and reintern that into the TI interner, is this correct?</p>



<a name="193638396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193638396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193638396">(Apr 11 2020 at 02:35)</a>:</h4>
<p>Maybe i should add something like <code>transfer_parameter_kinds</code> to <code>TargetInterner</code>.</p>



<a name="193639150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193639150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193639150">(Apr 11 2020 at 03:01)</a>:</h4>
<p>You might just be able to derive fold here</p>



<a name="193639156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193639156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193639156">(Apr 11 2020 at 03:01)</a>:</h4>
<p>Currently, binders aren't folded. But with the interner, they should be</p>



<a name="193639529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193639529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193639529">(Apr 11 2020 at 03:15)</a>:</h4>
<p>ok, let me have a try.</p>



<a name="193639530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193639530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193639530">(Apr 11 2020 at 03:15)</a>:</h4>
<p>thanks!</p>



<a name="193645625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193645625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193645625">(Apr 11 2020 at 06:39)</a>:</h4>
<p><a href="https://github.com/rust-lang/chalk/pull/386" title="https://github.com/rust-lang/chalk/pull/386">https://github.com/rust-lang/chalk/pull/386</a></p>



<a name="193781543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193781543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193781543">(Apr 13 2020 at 15:12)</a>:</h4>
<p>Now I'm trying to removing the <code>Interner</code> generics argument from <code>Binder</code>(I added it to finish the work). And here's this code:</p>
<div class="codehilite"><pre><span></span><span class="k">impl</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="p">,</span><span class="w"> </span><span class="n">I</span><span class="p">,</span><span class="w"> </span><span class="n">V</span><span class="o">&gt;</span><span class="w"> </span><span class="nb">IntoIterator</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="o">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="n">Binders</span><span class="o">&lt;</span><span class="n">V</span><span class="o">&gt;</span><span class="w"></span>
<span class="k">where</span><span class="w"></span>
<span class="w">    </span><span class="n">I</span>: <span class="nc">Interner</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">V</span>: <span class="nc">HasInterner</span><span class="o">&lt;</span><span class="n">Interner</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">I</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="o">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="n">V</span>: <span class="nb">IntoIterator</span><span class="p">,</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Item</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Binders</span><span class="o">&lt;&lt;&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="n">V</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nb">IntoIterator</span><span class="o">&gt;</span>::<span class="n">Item</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">IntoIter</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">BindersIntoIterator</span><span class="o">&lt;&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="n">V</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>

<span class="w">    </span><span class="k">fn</span> <span class="nf">into_iter</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span>::<span class="n">IntoIter</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="bp">self</span><span class="p">.</span><span class="n">map_ref</span><span class="p">(</span><span class="o">|</span><span class="n">r</span><span class="o">|</span><span class="w"> </span><span class="n">r</span><span class="p">).</span><span class="n">into_iter</span><span class="p">()</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="193781578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193781578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193781578">(Apr 13 2020 at 15:12)</a>:</h4>
<p>During compilation this emits:</p>
<div class="codehilite"><pre><span></span>error[E0275]: overflow evaluating the requirement `&amp;_: std::iter::IntoIterator`
  |
  = help: consider adding a `#![recursion_limit=&quot;256&quot;]` attribute to your crate
  = note: required because of the requirements on the impl of `std::iter::IntoIterator` for `&amp;Binders&lt;_&gt;`
  = note: required because of the requirements on the impl of `std::iter::IntoIterator` for `&amp;Binders&lt;Binders&lt;_&gt;&gt;`
  = note: required because of the requirements on the impl of `std::iter::IntoIterator` for `&amp;Binders&lt;Binders&lt;Binders&lt;_&gt;&gt;&gt;`
</pre></div>



<a name="193782284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193782284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193782284">(Apr 13 2020 at 15:19)</a>:</h4>
<p>Can you show BindersIntoIterator?</p>



<a name="193782486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193782486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193782486">(Apr 13 2020 at 15:20)</a>:</h4>
<p>And impl for Binders (thats probably the culprit)</p>



<a name="193782494"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193782494" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193782494">(Apr 13 2020 at 15:20)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="k">impl</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="p">,</span><span class="w"> </span><span class="n">V</span><span class="o">&gt;</span><span class="w"> </span><span class="nb">IntoIterator</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="o">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="n">Binders</span><span class="o">&lt;</span><span class="n">V</span><span class="o">&gt;</span><span class="w"></span>
<span class="k">where</span><span class="w"></span>
<span class="w">    </span><span class="n">V</span>: <span class="nc">HasInterner</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="o">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="n">V</span>: <span class="nb">IntoIterator</span><span class="p">,</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Item</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Binders</span><span class="o">&lt;&lt;&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="n">V</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nb">IntoIterator</span><span class="o">&gt;</span>::<span class="n">Item</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">IntoIter</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">BindersIntoIterator</span><span class="o">&lt;&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="n">V</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>

<span class="w">    </span><span class="k">fn</span> <span class="nf">into_iter</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span>::<span class="n">IntoIter</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="bp">self</span><span class="p">.</span><span class="n">map_ref</span><span class="p">(</span><span class="o">|</span><span class="n">r</span><span class="o">|</span><span class="w"> </span><span class="n">r</span><span class="p">).</span><span class="n">into_iter</span><span class="p">()</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="sd">/// Allows iterating over a Binders&lt;Vec&lt;T&gt;&gt;, for instance.</span>
<span class="sd">/// Each element will include the same set of parameter bounds.</span>
<span class="k">impl</span><span class="o">&lt;</span><span class="n">V</span><span class="o">&gt;</span><span class="w"> </span><span class="nb">IntoIterator</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Binders</span><span class="o">&lt;</span><span class="n">V</span><span class="o">&gt;</span><span class="w"></span>
<span class="k">where</span><span class="w"></span>
<span class="w">    </span><span class="n">V</span>: <span class="nc">HasInterner</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="nb">IntoIterator</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="o">&lt;</span><span class="n">V</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nb">IntoIterator</span><span class="o">&gt;</span>::<span class="n">Item</span>: <span class="nc">HasInterner</span><span class="p">,</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">Item</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Binders</span><span class="o">&lt;&lt;</span><span class="n">V</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nb">IntoIterator</span><span class="o">&gt;</span>::<span class="n">Item</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">IntoIter</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">BindersIntoIterator</span><span class="o">&lt;</span><span class="n">V</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>

<span class="w">    </span><span class="k">fn</span> <span class="nf">into_iter</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span>::<span class="n">IntoIter</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">BindersIntoIterator</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="n">iter</span>: <span class="nc">self</span><span class="p">.</span><span class="n">value</span><span class="p">.</span><span class="n">into_iter</span><span class="p">(),</span><span class="w"></span>
<span class="w">            </span><span class="n">binders</span>: <span class="nc">self</span><span class="p">.</span><span class="n">binders</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">struct</span> <span class="nc">BindersIntoIterator</span><span class="o">&lt;</span><span class="n">V</span>: <span class="nc">HasInterner</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="nb">IntoIterator</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">iter</span>: <span class="o">&lt;</span><span class="n">V</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nb">IntoIterator</span><span class="o">&gt;</span>::<span class="n">IntoIter</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">binders</span>: <span class="nc">ParameterKinds</span><span class="o">&lt;</span><span class="n">V</span>::<span class="n">Interner</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="193782523"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193782523" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193782523">(Apr 13 2020 at 15:21)</a>:</h4>
<p>I think it's caused by the first two impls.</p>



<a name="193783028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193783028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193783028">(Apr 13 2020 at 15:25)</a>:</h4>
<p>So I know the problem, probably</p>



<a name="193783120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193783120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193783120">(Apr 13 2020 at 15:26)</a>:</h4>
<p>You need <code>&lt;V as IntoIterator&gt;::Item: HasInterner</code> bound on the first impl</p>



<a name="193783232"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193783232" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193783232">(Apr 13 2020 at 15:27)</a>:</h4>
<p>let me have a try</p>



<a name="193783362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193783362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193783362">(Apr 13 2020 at 15:28)</a>:</h4>
<p>Sorry, <code>&lt;&amp;'a V as IntoIterator&gt;::Item: HasInterner</code></p>



<a name="193783405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193783405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193783405">(Apr 13 2020 at 15:29)</a>:</h4>
<p>yes, adding <code>&lt;&amp;'a V as IntoIterator&gt;::Item: HasInterner</code> solves the problem! thanks!</p>



<a name="193783451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193783451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193783451">(Apr 13 2020 at 15:29)</a>:</h4>
<p>rustc tries to resolve <code>self.map_ref(|r| r).into_iter()</code>, so it tries to find <code>IntoIter</code> impl for <code>Binders&lt;&amp;V&gt;</code>, but your second impl doesnt qualify for that because it has a <code>V: HasInterner</code> bound</p>



<a name="193783818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193783818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193783818">(Apr 13 2020 at 15:32)</a>:</h4>
<p>thanks for the explanation! <span aria-label="heart" class="emoji emoji-2764" role="img" title="heart">:heart:</span> i'll continue with the refactor.</p>



<a name="193793357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193793357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193793357">(Apr 13 2020 at 16:59)</a>:</h4>
<p>Refactor complete! Gonna have some sleep now :)</p>



<a name="193803200"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193803200" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193803200">(Apr 13 2020 at 18:23)</a>:</h4>
<p>Hey, so I am catching up now after leaving comments on the PR,</p>



<a name="193803211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193803211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193803211">(Apr 13 2020 at 18:23)</a>:</h4>
<p>but I'd still prefer to avoid <code>Canonical&lt;I, T&gt;</code></p>



<a name="193803213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193803213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193803213">(Apr 13 2020 at 18:23)</a>:</h4>
<p>although it's not the end of the world</p>



<a name="193817592"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193817592" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193817592">(Apr 13 2020 at 20:30)</a>:</h4>
<p>OK, so, judgement call needed:</p>



<a name="193817613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193817613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193817613">(Apr 13 2020 at 20:30)</a>:</h4>
<p>the PR uses <code>ParameterKindsWithUniverseIndex</code> as a type name</p>



<a name="193817627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193817627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193817627">(Apr 13 2020 at 20:30)</a>:</h4>
<p>I think eventually we're going to want a name like <code>CanonicalVarKinds</code> or something</p>



<a name="193817637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193817637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193817637">(Apr 13 2020 at 20:30)</a>:</h4>
<p>rustc uses <code>CanonicalVarInfos</code></p>



<a name="193817642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193817642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193817642">(Apr 13 2020 at 20:30)</a>:</h4>
<p>should we do this prior to landing the PR?</p>



<a name="193817647"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193817647" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193817647">(Apr 13 2020 at 20:31)</a>:</h4>
<p>As follow-up?</p>



<a name="193818044"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193818044" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193818044">(Apr 13 2020 at 20:34)</a>:</h4>
<p>I would say just rename it now, it's not like it's blocking anything</p>



<a name="193818095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193818095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193818095">(Apr 13 2020 at 20:35)</a>:</h4>
<p>Agreed. I don't really like the long <code>ParameterKindsWithUniverseIndex</code> name</p>



<a name="193818901"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193818901" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193818901">(Apr 13 2020 at 20:42)</a>:</h4>
<p>CanonicalVarKinds?</p>



<a name="193818907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193818907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193818907">(Apr 13 2020 at 20:42)</a>:</h4>
<p>Seems ok -- analogous to <code>ParameterVarKinds</code></p>



<a name="193818916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193818916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193818916">(Apr 13 2020 at 20:42)</a>:</h4>
<p>maybe we should rename that to <code>BinderVarKinds</code>?</p>



<a name="193822492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193822492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193822492">(Apr 13 2020 at 21:16)</a>:</h4>
<p>er, I guess it's <code>ParameterKinds</code></p>



<a name="193822514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193822514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193822514">(Apr 13 2020 at 21:16)</a>:</h4>
<p>anyway I sort of like <code>BoundVarKinds</code> (the "kinds" of the bound variables)</p>



<a name="193822524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193822524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193822524">(Apr 13 2020 at 21:17)</a>:</h4>
<p>and <code>CanonicalVarKinds</code> (the "kinds" of the canonical variables)</p>



<a name="193841600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193841600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193841600">(Apr 14 2020 at 01:12)</a>:</h4>
<p>I'm awake now. Ok, i'll do the renaming after i'm back from day job. I'll rename both?</p>



<a name="193841842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193841842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193841842">(Apr 14 2020 at 01:17)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="k">pub</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="n">IntoBindersAndValue</span><span class="o">&lt;</span><span class="n">I</span>: <span class="nc">Interner</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">into_binders_and_value</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="n">I</span><span class="p">)</span><span class="w"></span>
</pre></div>


<p>In my initial version i actually have it exactly like this. However the interner borrow (&amp;I) need to outlive the borrowed Binder, it should be &amp;'a I while Self: 'a. The code will be a little messier. Shall we go for this approach?</p>



<a name="193873840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193873840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193873840">(Apr 14 2020 at 09:55)</a>:</h4>
<p>Hmm, I think I'd still prefer it, but that is somewhat unexpected</p>



<a name="193873940"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193873940" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193873940">(Apr 14 2020 at 09:56)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116458">Charles Lew</span> <a href="#narrow/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369/near/193841600" title="#narrow/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369/near/193841600">said</a>:</p>
<blockquote>
<p>I'm awake now. Ok, i'll do the renaming after i'm back from day job. I'll rename both?</p>
</blockquote>
<p>On the PR I only requested renaming one, because I couldn't really decide what <code>ParameterKinds</code> <em>should</em> be called, but I would be ok with renaming both too.</p>



<a name="193873978"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193873978" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193873978">(Apr 14 2020 at 09:56)</a>:</h4>
<p>ParameterKinds is not the <em>worst</em>, these are generic parameters</p>



<a name="193874241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193874241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193874241">(Apr 14 2020 at 09:58)</a>:</h4>
<p><code>Kinds</code> was a little confusing because from in rust they are kinds, but in logic they are sorts, that threw me for a loop for a bit</p>



<a name="193881902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/193881902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#193881902">(Apr 14 2020 at 11:18)</a>:</h4>
<p>Adjusted the code :)</p>



<a name="194337953"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/194337953" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#194337953">(Apr 16 2020 at 17:16)</a>:</h4>
<p>Rebase done~</p>



<a name="194420550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Wanna%20help%20finishing%20up%20%23369/near/194420550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Wanna.20help.20finishing.20up.20.23369.html#194420550">(Apr 17 2020 at 10:23)</a>:</h4>
<p><span class="user-mention" data-user-id="116458">@Charles Lew</span> thanks -- I saw one nit, I may drop in and push a fix tho if you're not around</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>